/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package domoticus;

import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Samunake
 */
public class LightActuator implements Actuator{
    
    Double maxValue;
    Double minValue;
    ArduinoConnection conection;
    
    public LightActuator(){
        conection = new ArduinoConnection();
    }

    public LightActuator(Double valueMin,Double valueMax) {
        conection = new ArduinoConnection();
        this.maxValue = valueMax;
        this.minValue = valueMin;
           
    }
    
    
    @Override
    public void setMaxValue(Double valueMax) {
        try {
            conection.startConnection();
            this.maxValue = valueMax;
        } catch (IOException ex) {
            Logger.getLogger(LightActuator.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    
    @Override
    public void setMinValue(Double valueMin) {
        try {
            conection.startConnection();
        } catch (IOException ex) {
            Logger.getLogger(LightActuator.class.getName()).log(Level.SEVERE, null, ex);
        }
        this.minValue = valueMin;
    }
   
    @Override
    public Double getMaxValue() {
        return maxValue;
    }
  
    @Override
    public Double getMinValue() {
        return minValue;
    }
    
    public void sentArduinoON(){
        try {
            conection.startConnection();
        } catch (IOException ex) {
            Logger.getLogger(LightActuator.class.getName()).log(Level.SEVERE, null, ex);
        }
        conection.sentData("3");
    }
    public void sentArduinoOFF(){
        try {
            conection.startConnection();
        } catch (IOException ex) {
            Logger.getLogger(LightActuator.class.getName()).log(Level.SEVERE, null, ex);
        }
        conection.sentData("4");
    }
}
